int a[10][7] = {
  { 1, 1, 1, 1, 1, 1, 0},
  { 0, 1, 1, 0, 0, 0, 0},
  { 1, 1, 0, 1, 1, 0, 1},
  { 1, 1, 1, 1, 0, 0, 1},
  { 0, 1, 1, 0, 0, 1, 1},
  { 1, 0, 1, 1, 0, 1, 1},
  { 1, 0, 1, 1, 1, 1, 1},
  { 1, 1, 1, 0, 0, 0, 0},
  { 1, 1, 1, 1, 1, 1, 1},
  { 1, 1, 1, 1, 0, 1, 1},
};
int l_pin = 12;
int r_pin = 11;
void setup() {

  for (int i = 3; i <= 9; i++) {
    pinMode(i, OUTPUT);

  }
  pinMode(l_pin, OUTPUT);
  pinMode(r_pin, OUTPUT);
  digitalWrite(l_pin, 0);
  digitalWrite(r_pin, 0);
  // put your setup code here, to run once:

}
void print_led(int t) { //t是对应的数字集合
  for (int i = 0; i <= 7; i++) {
    digitalWrite(i + 3, a[t][i]);

  }

}

void get_no(int no ) {
  for (int j = 0 ; j < 250; j++) {
    if (no < 10) {
      digitalWrite(l_pin, 1); //右位x1
      digitalWrite(r_pin, 0); //左位x10
      print_led(no);
      delay(4);
    }
    else {
      //显示右位
      digitalWrite(l_pin, 1); //右位x1
      digitalWrite(r_pin, 0); //左位x10
      print_led(no % 10);
      delay(2);
      //显示左位
      digitalWrite(l_pin, 0); //右位x1
      digitalWrite(r_pin, 1); //左位x10
      print_led(no / 10 % 10);
      delay(2);
    }
  }
}
void loop() {
  // put your main code here, to run repeatedly:
  for (int i = 0; i <100; i++) {
    get_no(i);
    //delay(400);
  }
}
